home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 July / 07_02.iso / macos / files / Netscape-mac-full.bin / Netscape-mac-full / Netscape Full Installer / Installer Modules / nim.xpi / viewer / Components / nsJSAimFileXferRendezvous.js < prev    next >
Text File  |  2002-05-12  |  2KB  |  72 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*
  3.  */
  4.  
  5. function nsJSAimFileXferRendezvous() {
  6.     dump("creating new nsJSAimFileXferRendezvous\n");
  7. }
  8.  
  9. nsJSAimFileXferRendezvous.prototype = {
  10.     // we just implement one function!
  11.     OnProposalReceived : function (screenname, proposal)
  12.     {
  13.  
  14.      inviteArgsObj = {
  15.          inviteProposalScreenName: screenname, 
  16.          inviteProposalObj: proposal,
  17.          inviteMode: 'incomingfile'
  18.      }
  19.     
  20.      var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  21.  
  22.      var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  23.  
  24.      var topWindow = windowManagerInterface.getMostRecentWindow(null);
  25.  
  26.      
  27.      //topWindow.focus();
  28.      topWindow.openDialog('chrome://aim/content/incomingFile.xul','_blank','chrome,all,dialog=no',inviteArgsObj); 
  29.     
  30.     }
  31. }
  32.  
  33. var module = {
  34.     registerSelf: function (compMgr, fileSpec, location, type) {
  35.         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
  36.         compMgr.registerComponentWithType(this.myCID,
  37.             "nsJSAimFileXferRendezvous",
  38.                 "@netscape.com/js/aim/filexferrendezvous;1",
  39.                 fileSpec, location, true, true, type);
  40.     },
  41.  
  42.     getClassObject: function (compMgr, cid, iid) {
  43.         if (!cid.equals(this.myCID))
  44.             throw Components.results.NS_ERROR_NO_INTERFACE;
  45.         
  46.         if (!iid.equals(Components.interfaces.nsIFactory))
  47.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  48.  
  49.         return this.myFactory;
  50.     },
  51.  
  52.     canUnload: function () {
  53.     },
  54.     
  55.     myCID: Components.ID("{98763432-2DC7-11d4-BA1A-0010833594E9}"),
  56.     
  57.     myFactory: {
  58.         createInstance: function (outer, iid) {
  59.             if (outer != null)
  60.                 throw Components.results.NS_ERROR_NO_AGGREGATION;
  61.             
  62.             if (!(iid.equals(Components.interfaces.nsIAimFileXferRendezvousCallback) || iid.equals(Components.interfaces.nsISupports))) {
  63.                 throw Components.results.NS_ERROR_INVALID_ARG;
  64.             }
  65.  
  66.             return new nsJSAimFileXferRendezvous();
  67.         }
  68.     }
  69. };
  70.  
  71. function NSGetModule(compMgr, fileSpec) { return module; }
  72.